package com.sinosoft.ebusiness.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @Author: xlr
 * @Date: Created in 下午1:59 2017/9/4
 */
public class SpringBeanUtil implements ApplicationContextAware {

    static ApplicationContext applicationContext;

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }


    public static  <T> T getBean(String beanName){

        return (T) applicationContext.getBean( beanName );
    }
 }
